<div id="assetList">
  <div class="listOptions">
    <span><a href="{$site_url}/?module=assets{if $corp}&corp=1{/if}">All assets, by location</a></span>
    <span><a href="{$site_url}/?module=assets{if $corp}&corp=1{/if}&type=ships">Ships</a></span>
    <span>Search: 
      <input type="text" id="assetFind" value="{$search}" /> 
      <button onclick="window.location='{$site_url}/?module=assets{if $corp}&corp=1{/if}&type=find&item='+$('#assetFind').val()">Go</button>
    </span>
  </div>
  {if $pageCount > 0}
  <div align="right">
    {if $prevPage < $pageNum}
    <button onclick="window.location='{$site_url}/?module=assets{if $corp}&corp=1{/if}&type=ships&p={$prevPage}'" class="pageNav"> &lt;&lt; </button>
    {/if}
    &nbsp; pg {$pageNum+1} / {$pageCount} &nbsp;
    {if $nextPage < $pageCount}
    <button onclick="window.location='{$site_url}/?module=assets{if $corp}&corp=1{/if}&type=ships&p={$nextPage}'" class="pageNav"> &gt;&gt; </button>
    {/if}
  </div>
  {/if}

  {if !$ships}
  <h3>{if $corp}Your corporation has{else}You have{/if} no ships!</h3>
  {/if}

  <table width="100%" border="0">
    {foreach from=$ships item=ship}
    <tr class="groupHead shadeDark borderDark textLight">
      <td colspan="3" class="assetGroup" data-assetid="{$ship._ooe_id}">
        <img src="{$site_url}/{$ship.item.icon.icon64}" class="i64 showInfo" data-typeid="{$ship.item.typeid}" alt="{$ship.item.typename}" align="left" style="margin-right: 10px" />
        {$ship.item.typename}<br />{$ship.item.group.groupname}<br /><small>{$ship.locationName}</small>
      </td>
    </tr>
    {if $ship.contents}
    <tr>
      <td colspan="3">
        <div style="display:none" id="{$ship._ooe_id}">
          <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="450" valign="top">
                <div class="fitting">
                  <div class="slots">
                    {foreach from=$ship.contents item=ass name='moo'}
                    {if (($ass.flag >= 11) && ($ass.flag <= 34))}
                    <div class="slot{$ass.flag}">
                      <img src="{$site_url}/{$ass.item.icon.icon64}" class="i64 showInfo" data-typeid="{$ass.item.typeid}" alt="{$ass.item.typename}" align="absmiddle" />
                    </div>
                    {/if}
                    {/foreach}
                  </div>
                  <div class="rigSlots">
                    {foreach from=$ship.contents item=ass name='poo'}
                    {if (($ass.flag >= 92) && ($ass.flag <= 99))}
                    <img src="{$site_url}/{$ass.item.icon.icon64}" class="i64 showInfo" data-typeid="{$ass.item.typeid}" alt="{$ass.item.typename}" align="absmiddle" class="rig" />
                    {/if}
                    {/foreach}
                  </div>
                </div>
              </td>
              <td valign="top" style="font-size: 0.95em">
                <table width="100%" border="0">
                  <tr>
                    <th width="65%">Item</th>
                    <th width="25%">Location</th>
                    <th width="10%">Qty</th>
                  </tr>
                </table>
                {foreach from=$ship.contents item=ass name='foo'}
                {if (!(($ass.flag >= 11) && ($ass.flag <= 34)) && !(($ass.flag >= 92) && ($ass.flag <= 99)))}
                {include file="assetlist.html" asset=$ass last=$smarty.foreach.foo.last}
                {/if}
                {/foreach}
              </td>
            </tr>
          </table>
        </div>
      </td>
    </tr>
    {else}
    <tr>
      <td colspan="3">
        <div style="display:none; padding-left: 20px" id="{$ship._ooe_id}">
          <h3>This ship has no cargo and no fittings!</h3>
        </div>
      </td>
    </tr>
    {/if}
    {/foreach}
  </table>
</div>

<script type="text/javascript">
  $(document).ready(function() {
    $('.assetGroup').each(function() {
      $(this).css('cursor', 'pointer');
      $(this).click(function() {
        $('#' + $(this).data('assetid')).toggle('fast');
      });
    });
    
  });
</script>